package com.insigma.business.qrcode.soldier.entity;

import com.google.common.base.Strings;
import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;


@Data
public class SubsistenceAllowanceEntity implements Serializable {
    private static final long serialVersionUID = 3570607485530530875L;

    private String pk_sr_detail;
    private String dnl;
    private String djkzk;
    private String dsfxs;
    private String mybzje;
    private String mdbbz;
    private String dxb;
    private String mxsrs;
    private String mzjzje;
    private String mqtdbj;
    private String dgx;
    private String msqlb;
    private String mjzksrq;
    private String qhmc;
    private String mzpyy;
    private String mhzsfz;
    private String pk_sr_main;
    private String dcsrq;
    private String mjtlb;
    private String mhz;

    private static Map<String, String> jtgxMap = null;
    private static Map<String, String> jkztMap = null;
    private static Map<String, String> dblxMap = null;
    private static Map<String, String> zpyyMap = null;

    public void convert() {
        init();
        if (!Strings.isNullOrEmpty(dgx)) {
            String s = jtgxMap.get(dgx);
            if (s != null) {
                dgx = s;
            }
        }
        if (!Strings.isNullOrEmpty(djkzk)) {
            String s = jkztMap.get(djkzk);
            if (s != null) {
                djkzk = s;
            }
        }
        if (!Strings.isNullOrEmpty(mjtlb)) {
            String s = dblxMap.get(mjtlb);
            if (s != null) {
                mjtlb = s;
            }
        }
        if (!Strings.isNullOrEmpty(mzpyy)) {
            String s = zpyyMap.get(mzpyy);
            if (s != null) {
                mzpyy = s;
            }
        }
        if ("01".equals(dsfxs)) {
            dsfxs = "是";
        } else {
            dsfxs = "否";
        }
        if ("1".equals(dxb)) {
            dxb = "男";
        } else {
            dxb = "女";
        }
    }

    private static void init() {
        if (jtgxMap != null) {
            return;
        }
        jtgxMap = new HashMap<>();
        jtgxMap.put("01", "本人");
        jtgxMap.put("02", "儿子");
        jtgxMap.put("03", "女婿");
        jtgxMap.put("04", "女儿");
        jtgxMap.put("05", "媳妇");
        jtgxMap.put("10", "配偶");
        jtgxMap.put("20", "子/婿");
        jtgxMap.put("30", "女/媳");
        jtgxMap.put("40", "孙子、孙女或外孙子、外孙女");
        jtgxMap.put("50", "父母");
        jtgxMap.put("60", "祖父母或外祖父母");
        jtgxMap.put("70", "兄弟姐妹");
        jtgxMap.put("99", "其他");

        jkztMap = new HashMap<>();
        jkztMap.put("1", "健康");
        jkztMap.put("2", "一般（长病）");
        jkztMap.put("3", "一般残疾");
        jkztMap.put("4", "重度残疾");
        jkztMap.put("9", "其他");

        dblxMap = new HashMap<>();
        dblxMap.put("1", "收入型低保");
        dblxMap.put("2", "支出型贫困");
        dblxMap.put("3", "残疾人单列户施保");
        dblxMap.put("5", "重病型单列户施保");

        zpyyMap = new HashMap<>();
        zpyyMap.put("01", "疾病");
        zpyyMap.put("02", "灾害");
        zpyyMap.put("03", "残疾");
        zpyyMap.put("04", "缺乏劳动力");
        zpyyMap.put("05", "失业");
        zpyyMap.put("06", "失地");
        zpyyMap.put("07", "因学致贫");
        zpyyMap.put("08", "火灾");
        zpyyMap.put("09", "交通事故");
        zpyyMap.put("10", "突发意外事件");
        zpyyMap.put("99", "其他");
    }
}
